package com.cyf.db.mapper.ad;

import com.cyf.db.bean.ad.AdPayOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 信息发布的（广告的）支付订单
 * Created by hfy on 2017/5/16.
 */

public interface AdPayOrderMapper {

    // 根据 订单号查询订单
    @Select("select * from ad_payorder where orderNo = #{orderNo}")
    AdPayOrder getByOrderNo(@Param("orderNo") String orderNo);

    @Select("select * from ad_payorder where id = #{id}")
    AdPayOrder getById(@Param("id") int id);

    @Update("update ad_payorder set tradeType = #{tradeType}, payWay = #{payWay} where id = #{id}")
    void updatePayWay(@Param("tradeType") int tradeType, @Param("payWay") int payWay, @Param("id") Integer id);

    @Update("update ad_payorder set queryId = #{payOrder.queryId}, status = #{payOrder.status}, settleAmt = #{payOrder.settleAmt}, settleDate = #{payOrder.settleDate} where id = #{payOrder.id}")
    void updatePayOrder(@Param("payOrder") AdPayOrder adPayOrder);

    @Select("select * from ad_payorder where queryId = #{transactionId}")
    AdPayOrder getByTransactionId(@Param("transactionId") String transactionId);
}
